//https://www.jc2182.com/es6/es6-for-of.html#:~:text=ES6%20%E5%80%9F%E9%89%B4%20C%2B%2B%E3%80%81Java%E3%80%81C%23%20%E5%92%8C%20Python%20%E8%AF%AD%E8%A8%80%EF%BC%8C%E5%BC%95%E5%85%A5%E4%BA%86%20for...of,%E5%BE%AA%E7%8E%AF%EF%BC%8C%E4%BD%9C%E4%B8%BA%E9%81%8D%E5%8E%86%E6%89%80%E6%9C%89%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E7%9A%84%E7%BB%9F%E4%B8%80%E7%9A%84%E6%96%B9%E6%B3%95%E3%80%82%20%E4%B8%80%E4%B8%AA%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E5%8F%AA%E8%A6%81%E9%83%A8%E7%BD%B2%E4%BA%86%20Symbol.iterator%20%E5%B1%9E%E6%80%A7%EF%BC%8C%E5%B0%B1%E8%A2%AB%E8%A7%86%E4%B8%BA%E5%85%B7%E6%9C%89%20iterator%20%E6%8E%A5%E5%8F%A3%EF%BC%8C%E5%B0%B1%E5%8F%AF%E4%BB%A5%E7%94%A8%20for...of%20%E5%BE%AA%E7%8E%AF%E9%81%8D%E5%8E%86%E5%AE%83%E7%9A%84%E6%88%90%E5%91%98%E3%80%82

//JavaScript 原有的 for...in 循环，只能获得对象的键名，不能直接获取键值。ES6 提供 for...of 循环，允许遍历获得键值。

var arr = ['a', 'b', 'c', 'd'];

for (let a in arr) {
    console.log(a); // 0 1 2 3
}

for (let a of arr) {
    console.log(a); // a b c d
}
